package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Account  string `gorm:"type:varchar(30);comment:'账号'"`
	Password string `gorm:"type:char(32);comment:'密码'"`
}

func (u *User) GetUserByUsername(DB *gorm.DB) error {
	return DB.Where("account =?", u.Account).Limit(1).Find(&u).Error
}

func (u *User) Createuser(DB *gorm.DB) error {
	return DB.Create(&u).Error
}
